const mongoose = require("mongoose");
const schema = new mongoose.Schema({
  user: { type: String, index: true, unique: true, required: true },
  time: { type: String, required: true },
  avatar: { type: String, default: "https://wx.qlogo.cn/mmopen/vi_32/a3Ked7xPAATqbDv8CsyuEibIQC4vgAiamJWLHktJibDQnCd7C4DU8Mxekz1qh7OVpBQb3ic0Ct9eAUfDSBuDRoLvpg/132" },
  nickName: { type: String, default: "管理员" },
  routes:[],
  passWord: {
    type: String,
    required: true,
    select: false,
    set(val) {
      return require("bcrypt").hashSync(val, 10);
    }
  }
})

module.exports = mongoose.model("Admin", schema);